<?php

/**
 * For full documentation, please visit: http://docs.reduxframework.com/
 * For a more extensive sample-config file, you may look at:
 * https://github.com/reduxframework/redux-framework/blob/master/sample/sample-config.php
 */

if ( ! class_exists( 'Kirki' ) ) {
    return;
}

// This is your option name where all the Redux data is stored.
$opt_name = "lmy";

/**
 * ---> SET ARGUMENTS
 * All the possible arguments for Redux.
 * For full documentation on arguments, please refer to: https://github.com/ReduxFramework/ReduxFramework/wiki/Arguments
 * */

$theme = wp_get_theme(); // For use with some settings. Not necessary.

Kirki::add_config( 'lmywpgl', array(
    'capability'  => 'edit_theme_options',
    'option_type' => 'theme_mod',
    'disable_google_fonts'=>true,
) );


Kirki::add_section( 'homeslide', array(
    'title'       => "首页幻灯切换",
    'description' => "",
    'panel'       => '',
));

Kirki::add_field( 'lmywpgl', array(
    'type'        => 'image',
    'settings'    => 'homeslide_pic1',
    'label'       => esc_attr__( '图片1', 'wpgl' ),
    'description' => esc_attr__( '', 'wpgl' ),
    'section'     => 'homeslide',
    'default'     =>'',
));


Kirki::add_field( 'lmywpgl', array(
    'type'        => 'image',
    'settings'    => 'homeslide_pic2',
    'label'       => esc_attr__( '图片2', 'wpgl' ),
    'description' => esc_attr__( '', 'wpgl' ),
    'section'     => 'homeslide',
    'default'     =>'',
));


Kirki::add_field( 'lmywpgl', array(
    'type'        => 'image',
    'settings'    => 'homeslide_pic3',
    'label'       => esc_attr__( '图片3', 'wpgl' ),
    'description' => esc_attr__( '', 'wpgl' ),
    'section'     => 'homeslide',
    'default'     =>'',
));



//如果不关联panel，则直接到最外面的panel列表去
Kirki::add_section( 'homebox1_section', array(
    'title'       => "首页1homebox",
    'description' => "",
    'panel'       => '',
));

Kirki::add_field( 'lmywpgl', array(
    'type'        => 'text',
    'settings'    => 'homebox1_title',
    'label'       => esc_attr__( '主标题', 'wpgl' ),
    'description' => esc_attr__( '', 'wpgl' ),
    'section'     => 'homebox1_section',
    'default'     =>'德国高勒家装管道',
));

Kirki::add_field( 'lmywpgl', array(
    'type'        => 'text',
    'settings'    => 'homebox1_subtitle',
    'label'       => esc_attr__( '子标题', 'wpgl' ),
    'description' => esc_attr__( '', 'wpgl' ),
    'section'     => 'homebox1_section',
    'default'     =>'来自德国的管路系统专家',
));

Kirki::add_field( 'lmywpgl', array(
    'type'        => 'textarea',
    'settings'    => 'homebox1_content',
    'label'       => esc_attr__( '内容', 'wpgl' ),
    'description' => esc_attr__( '', 'wpgl' ),
    'section'     => 'homebox1_section',
    'default'     =>'德国高勒集团公司（GLORY Group GmbH），位于德国北莱茵-威斯特法伦州杜塞尔多夫',
));

Kirki::add_section( 'homebox2_section', array(
    'title'       => "首页2homebox",
    'description' => "",
    'panel'       => '',
));

Kirki::add_field( 'lmywpgl', array(
    'type'        => 'text',
    'settings'    => 'homebox2_title',
    'label'       => esc_attr__( '主标题', 'wpgl' ),
    'description' => esc_attr__( '', 'wpgl' ),
    'section'     => 'homebox2_section',
    'default'     =>'我们的服务 Our Services',
));

Kirki::add_field( 'lmywpgl', array(
    'type'        => 'textarea',
    'settings'    => 'homebox2_subtitle',
    'label'       => esc_attr__( '子标题', 'wpgl' ),
    'description' => esc_attr__( '', 'wpgl' ),
    'section'     => 'homebox2_section',
    'default'     =>'为人类健康饮水而努力，专业 、专注 、成就你我',
));

Kirki::add_field( 'lmywpgl', array(
    'type'        => 'text',
    'settings'    => 'homebox2_href1title',
    'label'       => esc_attr__( '页面1主标题', 'wpgl' ),
    'description' => esc_attr__( '', 'wpgl' ),
    'section'     => 'homebox2_section',
    'default'     =>'全球化的技术支持',
));

Kirki::add_field( 'lmywpgl', array(
    'type'        => 'text',
    'settings'    => 'homebox2_href1subtitle',
    'label'       => esc_attr__( '页面1子标题', 'wpgl' ),
    'description' => esc_attr__( '', 'wpgl' ),
    'section'     => 'homebox2_section',
    'default'     =>'Technical Support Services',
));

Kirki::add_field( 'lmywpgl', array(
    'type'        => 'dropdown-pages',
    'settings'    => 'homebox2_href1',
    'label'       => esc_attr__( '页面1链接', 'wpgl' ),
    'description' => esc_attr__( '', 'wpgl' ),
    'section'     => 'homebox2_section',
    'default'     => 1,
));

Kirki::add_field( 'lmywpgl', array(
    'type'        => 'text',
    'settings'    => 'homebox2_href2title',
    'label'       => esc_attr__( '页面2主标题', 'wpgl' ),
    'description' => esc_attr__( '', 'wpgl' ),
    'section'     => 'homebox2_section',
    'default'     =>'完善的培训服务',
));

Kirki::add_field( 'lmywpgl', array(
    'type'        => 'text',
    'settings'    => 'homebox2_href2subtitle',
    'label'       => esc_attr__( '页面2子标题', 'wpgl' ),
    'description' => esc_attr__( '', 'wpgl' ),
    'section'     => 'homebox2_section',
    'default'     =>'Perfect Training Services',
));

Kirki::add_field( 'lmywpgl', array(
    'type'        => 'dropdown-pages',
    'settings'    => 'homebox2_href2',
    'label'       => esc_attr__( '页面2链接', 'wpgl' ),
    'description' => esc_attr__( '', 'wpgl' ),
    'section'     => 'homebox2_section',
    'default'     => 1,
));

Kirki::add_field( 'lmywpgl', array(
    'type'        => 'text',
    'settings'    => 'homebox2_href3title',
    'label'       => esc_attr__( '页面3主标题', 'wpgl' ),
    'description' => esc_attr__( '', 'wpgl' ),
    'section'     => 'homebox2_section',
    'default'     =>'高效的品牌宣传系统',
));

Kirki::add_field( 'lmywpgl', array(
    'type'        => 'text',
    'settings'    => 'homebox2_href3subtitle',
    'label'       => esc_attr__( '页面3子标题', 'wpgl' ),
    'description' => esc_attr__( '', 'wpgl' ),
    'section'     => 'homebox2_section',
    'default'     =>'Brand Promotion System',
));

Kirki::add_field( 'lmywpgl', array(
    'type'        => 'dropdown-pages',
    'settings'    => 'homebox2_href3',
    'label'       => esc_attr__( '页面3链接', 'wpgl' ),
    'description' => esc_attr__( '', 'wpgl' ),
    'section'     => 'homebox2_section',
    'default'     => 1,
));

Kirki::add_field( 'lmywpgl', array(
    'type'        => 'text',
    'settings'    => 'homebox2_href4title',
    'label'       => esc_attr__( '页面4主标题', 'wpgl' ),
    'description' => esc_attr__( '', 'wpgl' ),
    'section'     => 'homebox2_section',
    'default'     =>'便利的产品追溯机制',
));

Kirki::add_field( 'lmywpgl', array(
    'type'        => 'text',
    'settings'    => 'homebox2_href4subtitle',
    'label'       => esc_attr__( '页面4子标题', 'wpgl' ),
    'description' => esc_attr__( '', 'wpgl' ),
    'section'     => 'homebox2_section',
    'default'     =>'Product Traceability Mechanism',
));

Kirki::add_field( 'lmywpgl', array(
    'type'        => 'dropdown-pages',
    'settings'    => 'homebox2_href4',
    'label'       => esc_attr__( '页面4链接', 'wpgl' ),
    'description' => esc_attr__( '', 'wpgl' ),
    'section'     => 'homebox2_section',
    'default'     => 1,
));

//区域3
Kirki::add_section( 'homebox3_section', array(
    'title'       => "首页3homebox",
    'description' => "",
    'panel'       => '',
));

Kirki::add_field( 'lmywpgl', array(
    'type'        => 'text',
    'settings'    => 'homebox3_title',
    'label'       => esc_attr__( '主标题', 'wpgl' ),
    'description' => esc_attr__( '', 'wpgl' ),
    'section'     => 'homebox3_section',
    'default'     =>'产品优势 Advantage',
));

Kirki::add_field( 'lmywpgl', array(
    'type'        => 'textarea',
    'settings'    => 'homebox3_subtitle',
    'label'       => esc_attr__( '子标题', 'wpgl' ),
    'description' => esc_attr__( '', 'wpgl' ),
    'section'     => 'homebox3_section',
    'default'     =>'高端产品的核心创新理念',
));

//方法二：通过数组来添加，适用于参数相同的情况，比较清晰。缺点是如果要多余参数就不能处理了
$control3 = array(

    $control[] = array("title"=>"按钮1标题","settings"=>"homebox3_btn1_title","default"=>"铜件内丝9牙设计","type"=>"text"),
    $control[] = array("title"=>"按钮1子标题","settings"=>"homebox3_btn1_subtitle","default"=>"与家用精品角阀、优质水龙头配件连接时更加安全、牢固。","type"=>"textarea"),
    $control[] = array("title"=>"按钮1链接","settings"=>"homebox3_btn1_href","default"=>1,"type"=>"dropdown-pages"),

    $control[] = array("title"=>"按钮2标题","settings"=>"homebox3_btn2_title","default"=>"全新闸阀通径设计","type"=>"text"),
    $control[] = array("title"=>"按钮2子标题","settings"=>"homebox3_btn2_subtitle","default"=>"闸阀相当于管道的流水量、闸阀的流水量是普通截止阀的2倍、是暗阀的4倍。","type"=>"textarea"),
    $control[] = array("title"=>"按钮2链接","settings"=>"homebox3_btn2_href","default"=>1,"type"=>"dropdown-pages"),


    $control[] = array("title"=>"按钮3标题","settings"=>"homebox3_btn3_title","default"=>"全新闸阀通径设计","type"=>"text"),
    $control[] = array("title"=>"按钮3子标题","settings"=>"homebox3_btn3_subtitle","default"=>"闸阀相当于管道的流水量、闸阀的流水量是普通截止阀的2倍、是暗阀的4倍。","type"=>"textarea"),
    $control[] = array("title"=>"按钮3链接","settings"=>"homebox3_btn3_href","default"=>1,"type"=>"dropdown-pages"),


    $control[] = array("title"=>"按钮4标题","settings"=>"homebox3_btn4_title","default"=>"全新闸阀通径设计","type"=>"text"),
    $control[] = array("title"=>"按钮4子标题","settings"=>"homebox3_btn4_subtitle","default"=>"闸阀相当于管道的流水量、闸阀的流水量是普通截止阀的2倍、是暗阀的4倍。","type"=>"textarea"),
    $control[] = array("title"=>"按钮4链接","settings"=>"homebox3_btn4_href","default"=>1,"type"=>"dropdown-pages"),


    $control[] = array("title"=>"按钮5标题","settings"=>"homebox3_btn5_title","default"=>"全新闸阀通径设计","type"=>"text"),
    $control[] = array("title"=>"按钮5子标题","settings"=>"homebox3_btn5_subtitle","default"=>"闸阀相当于管道的流水量、闸阀的流水量是普通截止阀的2倍、是暗阀的4倍。","type"=>"textarea"),
    $control[] = array("title"=>"按钮5链接","settings"=>"homebox3_btn5_href","default"=>1,"type"=>"dropdown-pages"),

    $control[] = array("title"=>"按钮6标题","settings"=>"homebox3_btn6_title","default"=>"全新闸阀通径设计","type"=>"text"),
    $control[] = array("title"=>"按钮6子标题","settings"=>"homebox3_btn6_subtitle","default"=>"闸阀相当于管道的流水量、闸阀的流水量是普通截止阀的2倍、是暗阀的4倍。","type"=>"textarea"),
    $control[] = array("title"=>"按钮6链接","settings"=>"homebox3_btn6_href","default"=>1,"type"=>"dropdown-pages"),

);

foreach($control3 as $v){

    Kirki::add_field( 'lmywpgl', array(
        'type'        => $v["type"],
        'settings'    => $v["settings"],
        'label'       => esc_attr__( $v["title"], 'wpgl' ),
        'description' => esc_attr__( '', 'wpgl' ),
        'section'     => 'homebox3_section',
        'default'     => $v["default"],
    ));

}

//区域4
Kirki::add_section( 'homebox4_section', array(
    'title'       => "首页4homebox",
    'description' => "",
    'panel'       => '',
));

Kirki::add_field( 'lmywpgl', array(
    'type'        => 'text',
    'settings'    => 'homebox4_title',
    'label'       => esc_attr__( '主标题', 'wpgl' ),
    'description' => esc_attr__( '', 'wpgl' ),
    'section'     => 'homebox4_section',
    'default'     =>'合作品牌 Partners',
));

Kirki::add_field( 'lmywpgl', array(
    'type'        => 'textarea',
    'settings'    => 'homebox4_subtitle',
    'label'       => esc_attr__( '子标题', 'wpgl' ),
    'description' => esc_attr__( '', 'wpgl' ),
    'section'     => 'homebox4_section',
    'default'     =>'德国高勒与你一道扬帆起航，实现商业转型与升级',
));

Kirki::add_field( 'lmywpgl', array(
    'type'        => 'number',
    'settings'    => 'homebox4_number',
    'label'       => esc_attr__( '显示数量', 'wpgl' ),
    'description' => esc_attr__( '', 'wpgl' ),
    'section'     => 'homebox4_section',
    'default'     =>10,
));


Kirki::add_field( 'lmywpgl', array(
    'type'        => 'select',
    'settings'    => 'homebox4_cid',
    'label'       => esc_attr__( '类别', 'wpgl' ),
    'description' => esc_attr__( '比如合作品牌,需要每个品牌一张图片', 'wpgl' ),
    'section'     => 'homebox4_section',
    'choices'  => Kirki_Helper::get_terms(array('taxonomy' => 'category')),
));


//区域5, 三个新闻区域
Kirki::add_section( 'homebox5_section', array(
    'title'       => "首页5homebox",
    'description' => "",
    'panel'       => '',
));


//公司信息
Kirki::add_section( 'companyinfo_section', array(
    'title'       => "公司信息",
    'description' => "",
    'panel'       => '',
));


function risana_custom_setting1( $controls ) {

    $categories=  get_categories(array('hide_empty'=>0));

    $choices = array();
    foreach($categories as $term){
        $term_id = $term->term_id;
        $name = $term->name;
        $choices[$term_id] =$name;
    }

    $control[] = array("label"=>"新闻区1标题","settings"=>"homebox5_news1_title","default"=>"公司新闻 News","type"=>"text","section"=>"homebox5_section");
    $control[] = array("label"=>"新闻区1栏目","settings"=>"homebox5_news1_catid","type"=>"select","section"=>"homebox5_section",'multiple'=> 1,'choices'=> $choices);
    $control[] = array("label"=>"新闻区1条数","settings"=>"homebox5_news1_count","default"=>"5","type"=>"text","section"=>"homebox5_section");
    $control[] = array("label"=>"新闻区1字数","settings"=>"homebox5_news1_length","default"=>"18","type"=>"text","section"=>"homebox5_section");
    $control[] = array("label"=>"新闻区1更多","settings"=>"homebox5_news1_more","default"=>"查看更多 More →","type"=>"text","section"=>"homebox5_section");

    $control[] = array("label"=>"新闻区2标题","settings"=>"homebox5_news2_title","default"=>"公司新闻 News","type"=>"text","section"=>"homebox5_section");
    $control[] = array("label"=>"新闻区2栏目","settings"=>"homebox5_news2_catid","type"=>"select","section"=>"homebox5_section",'multiple'=> 1,'choices'=> $choices);
    $control[] = array("label"=>"新闻区2条数","settings"=>"homebox5_news2_count","default"=>"5","type"=>"text","section"=>"homebox5_section");
    $control[] = array("label"=>"新闻区2字数","settings"=>"homebox5_news2_length","default"=>"18","type"=>"text","section"=>"homebox5_section");
    $control[] = array("label"=>"新闻区2更多","settings"=>"homebox5_news2_more","default"=>"查看更多 More →","type"=>"text","section"=>"homebox5_section");

    $control[] = array("label"=>"新闻区3标题","settings"=>"homebox5_news3_title","default"=>"公司新闻 News","type"=>"text","section"=>"homebox5_section");
    $control[] = array("label"=>"新闻区3栏目","settings"=>"homebox5_news3_catid","type"=>"select","section"=>"homebox5_section",'multiple'=> 1,'choices'=> $choices);
    $control[] = array("label"=>"新闻区3条数","settings"=>"homebox5_news3_count","default"=>"5","type"=>"text","section"=>"homebox5_section");
    $control[] = array("label"=>"新闻区3字数","settings"=>"homebox5_news3_length","default"=>"18","type"=>"text","section"=>"homebox5_section");
    $control[] = array("label"=>"新闻区3更多","settings"=>"homebox5_news3_more","default"=>"查看更多 More →","type"=>"text","section"=>"homebox5_section");

    $control[] = array("label"=>"公司全称","settings"=>"companyinfo_title","default"=>"xxx集团公司","type"=>"text","section"=>"companyinfo_section");
    $control[] = array("label"=>"公司电话1","settings"=>"companyinfo_phone1","default"=>"4008888888","type"=>"text","section"=>"companyinfo_section");
    $control[] = array("label"=>"公司电话2","settings"=>"companyinfo_phone2","default"=>"4008888888","type"=>"text","section"=>"companyinfo_section");
    $control[] = array("label"=>"公司地址","settings"=>"companyinfo_address","default"=>"德国·商业中心·杜塞尔多夫国王大道","type"=>"text","section"=>"companyinfo_section");
    $control[] = array("label"=>"公司邮箱","settings"=>"companyinfo_email","default"=>"aaa@gmail.com","type"=>"text","section"=>"companyinfo_section");
    $control[] = array("label"=>"版权文字","settings"=>"companyinfo_copyright","default"=>"Copyright 2017 高勒管道 沪ICP备15055634号-1","type"=>"text","section"=>"companyinfo_section");
    $control[] = array("label"=>"广告文本1","settings"=>"companyinfo_adtxt1","default"=>"加入高勒请致电免费热线 400-138-5766 →","type"=>"text","section"=>"companyinfo_section");




    return $control;
}

add_filter( 'kirki/controls', 'risana_custom_setting1' );
